#pragma once
#ifndef _KH_ENGINE_PLAYER_H
#define _KH_ENGINE_PLAYER_H
#include <Kharlia/Engine/Common.h>
#include <Kharlia/Engine/Net.h>

#include <CEGUIInputEvent.h>

namespace kharlia { namespace engine {

class CActor;
class FRMConnection;

class KH_ENGINE_API CPlayer: public core::CObject {
    bool mIsLocal;
    TWeakPtr<CActor> mActor;
    FRMConnection* mRMConnection;

    KH_DECL_GC()

public:
    CPlayer(PyObject* self, bool isLocal=false);
    virtual ~CPlayer();

    bool GetIsLocal() const { return mIsLocal; }
    TPtr<CActor> GetActor() const { return mActor.Lock(); }
    void SetActor(TPtr<CActor> const& v) { mActor = v; }
    FRMConnection* GetRMConnection() const { return mRMConnection ; }
    void SetRMConnection(FRMConnection* v) { mRMConnection = v; }

    friend void _InitPlayerClasses();
};

class KH_ENGINE_API CLocalPlayer: public CPlayer {
    KH_DECL_GC()

public:
    CLocalPlayer(PyObject* self);
    virtual ~CLocalPlayer();

    void OnKeyDown(ui::Key::Scan keycode);

    friend void _InitPlayerClasses();
};

}} // namespace Kharlia

ENABLE_BACK_REFERENCE(kharlia::engine::CPlayer)
ENABLE_BACK_REFERENCE(kharlia::engine::CLocalPlayer)

#endif // _KH_ENGINE_PLAYER_H